#ifndef AGENTPUSH_H
#define AGENTPUSH_H

#include <QObject>
#include <QMap>
#include <QTimer>

class AgentPush : public QObject
{
    Q_OBJECT
public:
    explicit AgentPush(QObject *parent = 0);

signals:
    void sigSendDataToApp(QByteArray packet,QString paramAppIP,quint16 paramAppPort);

public slots:
    void pushToApps(QByteArray packet);//将消息推送给APP
    void newSubscriber(QByteArray parSNOfReq,
                QByteArray baIPPort,QByteArray origRequestpacket);//新增一个订阅者
public:
    QMap <QByteArray,QByteArray> getMapIPPortReqPacket();
private slots:
    void slotTimerTTL();
private:
    QMap <QByteArray,QByteArray> mapIPPortReqPacket; //记录各个IPPort对应的请求数据包
    QMap <QByteArray,qint16> mapIPPortTTL; //用于判断Alive
    quint32 timerIntervalMilliSecs;
    QTimer timerForTTL;
    quint16 ttlMax;
    QByteArray sNOfReq;

};

#endif // AGENTPUSH_H
